import * as React from 'react'
import {getOrderFilesVoOfProductionPlan} from '@/api/startWorking'

interface Props {
  name: string
  code: string
}

interface Product {
  pid: number
  code: string

}

interface Result {
  limit: number
  current: number
  items: Product[]
}

interface Response<T> {
  Result: T
  Code: number
  Message: string
}

const data: Response<Result> = getOrderFilesVoOfProductionPlan();
// data.Result.items[0].pid

const Azure = (props: Props):JSX.Element => {
  // getOrderFilesVoOfProductionPlan()
  // getOrderFilesVoOfProductionPlan
  // props.code
  return <div>111</div>
}

export interface MyComponentProps {
  className?: string;
  style?: React.CSSProperties;
}

// export const MyComponent: FC<MyComponentProps> = props => {
//   return <div>hello react</div>;
// }

function ctor({a:{d:number},b:string}){

}

ctor({a:{d:1},b:''})

interface Datum {
  a: [string],
}


let myName: string = 'Tom';
let myAge: number = 25;
// let a = `asdas${myAge} --- ${myName}fff$$$`
// console.log(a);


let n: null = null
let u: undefined = undefined
let v: void
let a: any = {}

interface Person {
  readonly name: string;
  age?: number;

  [k: string]: any
}

let tom: Person = {
  name: 'Tom',
  // age:1,
  otherProp1: '1'
};

let list: string[] = []
list.push('1')
const aaa = tom.otherProp1;

function sum() {
  let args: strArr = arguments;

}

function sum1() {
  let args: {
    [index: number]: number;
    length: number;
    callee: Function;
  } = arguments;

}

function sum3(): object {

  return {
    a: 1
  }
}

interface strArr {
  [idx: number]: string
}

interface FnI {
  (a: string, b: number): string
}

const f1: FnI = (a, b) => a
const f2: (string, number) => string = (a, b) => a
const f3 = (a: number, b?: string) => {

}

const f4 = (a: string = 'aaa') => {

}

f4('111')
f4()

function f5<T, U>(arr: T[], ...rest: T[]): void {

}

// function f6() :string
function reverse(x: number): number;
function reverse(x: string): string;
function reverse(x: number | string): number | string {
  if (typeof x === 'number') {
    return Number(x.toString().split('').reverse().join(''));
  } else if (typeof x === 'string') {
    return x.split('').reverse().join('');
  }
  return 1
}

// ('123' as number).toFixed()

function getCacheData(key: string): any {
  return (window as any).cache[key];
}

// const www :Window = window
// www.caches
interface Cat {
  name: string;

  run(): void;
}

const ttt = getCacheData('tom') as Cat;
ttt.run();


const strArr: strArr = ['1']

const Datum: Datum = {a: ['1']}

const Types = ["aaa", "bbb"]

const creator = function <T extends U, U = string>(arr: []): any[] {
  // return arr.reduce((acc, cur) => ({...acc, [cur]: cur}), {})

  return []
}

// creator(Types)
let joy: [string, number];
joy = ['1', 2]

// joy.push({})

enum Director {
  Top = 1
}

interface SearchFunc {
  <T, U extends T>([T, U]): T & U
}

interface Alert {
  // aaa :(a,b)void
  success<T, U extends T>([T, U]): T & U

}


class Animal {
  private name;

  public constructor(name) {
    this.name = name;
  }
}

export {Azure}
